package com.yili.oa.dao;

import com.yili.oa.models.Payment;
import com.yili.oa.models.PaymentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface PaymentMapper {
    @SelectProvider(type=PaymentSqlProvider.class, method="countByExample")
    long countByExample(PaymentExample example);

    @DeleteProvider(type=PaymentSqlProvider.class, method="deleteByExample")
    int deleteByExample(PaymentExample example);

    @Delete({
        "delete from ft_payment",
        "where payment_id = #{paymentId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long paymentId);

    @Insert({
        "insert into ft_payment (payment_id, payment_name, ",
        "payment_create_time)",
        "values (#{paymentId,jdbcType=BIGINT}, #{paymentName,jdbcType=VARCHAR}, ",
        "#{paymentCreateTime,jdbcType=TIMESTAMP})"
    })
    int insert(Payment record);

    @InsertProvider(type=PaymentSqlProvider.class, method="insertSelective")
    int insertSelective(Payment record);

    @SelectProvider(type=PaymentSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="payment_id", property="paymentId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="payment_name", property="paymentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="payment_create_time", property="paymentCreateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Payment> selectByExample(PaymentExample example);

    @Select({
        "select",
        "payment_id, payment_name, payment_create_time",
        "from ft_payment",
        "where payment_id = #{paymentId,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="payment_id", property="paymentId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="payment_name", property="paymentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="payment_create_time", property="paymentCreateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    Payment selectByPrimaryKey(Long paymentId);

    @UpdateProvider(type=PaymentSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Payment record, @Param("example") PaymentExample example);

    @UpdateProvider(type=PaymentSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Payment record, @Param("example") PaymentExample example);

    @UpdateProvider(type=PaymentSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Payment record);

    @Update({
        "update ft_payment",
        "set payment_name = #{paymentName,jdbcType=VARCHAR},",
          "payment_create_time = #{paymentCreateTime,jdbcType=TIMESTAMP}",
        "where payment_id = #{paymentId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Payment record);
}